package com.ruoyi.accountant.dao;

import com.ruoyi.accountant.domain.Account;
import com.ruoyi.accountant.domain.Device;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

import java.util.List;

public interface DeviceDao extends TempDao<Device, Long> {

    /***
     * 查询没有折旧完成的设备
     * @return
     */
    @Query("from Device as t where t.startdate <= date(now()) and t.finished = 0")
    List<Device> findUnfinished();

    /***
     * 根据账户查询是否折旧完成的设备
     * @param aid
     * @param finished
     * @return
     */
    List<Device> findByOfAccountAndFinishedIs(Long aid, int finished);
}
